package com.xzakota.minesweeper.model.entity;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

/**
 * 用户实体类
 *
 * @author Xzakota
 */
public class UserBean implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    public String username;
    public String password;
    public String qq;
    public int score = 0;
    public int time = -1;
    public int online;

    public UserBean() {
    }

    public UserBean(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public UserBean(String username, String password, String qq) {
        this.username = username;
        this.password = password;
        this.qq = qq;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        UserBean userBean = (UserBean) o;
        return online == userBean.online && Objects.equals(username, userBean.username) && Objects.equals(password, userBean.password) && Objects.equals(qq, userBean.qq);
    }

    @Override
    public int hashCode() {
        return Objects.hash(username, password, qq, online);
    }

    @Override
    public String toString() {
        return "UserBean{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", qq='" + qq + '\'' +
                ", score=" + score +
                ", time=" + time +
                ", online=" + online +
                '}';
    }
}
